{include file="public/header296" /}
<div class="layui-form" style="padding-top: 10px;">
  <div class="layui-form-item">
    <label class="layui-form-label">标题</label>
    <div class="layui-input-inline">
      <input type="text" name="name" value="{$item.name}" placeholder="请输入标题" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-upload" id="upload-thumb">
    <label class="layui-form-label">Banner</label>
    <button type="button" class="layui-btn" id="Lay-app-form-picture">上传封面</button><div class="layui-inline layui-word-aux">295x385</div>
    <div class="layui-upload-list">
      <label class="layui-form-label"></label>
      <img class="layui-upload-img" id="test-upload-normal-img" {notempty name="$item.image_url"}src="{$item.image_url}"{/notempty}>
    </div>
    <label class="layui-form-label"></label>
    <p id="test-upload-demoText" style="margin-bottom:5px; "></p>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">地址url</label>
    <div class="layui-input-block">
      <input type="text" name="image_url" id="image_url" value="{$item.image_url}" style="width: 90%" placeholder="外部图片地址url" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">职位</label>
      <div class="layui-input-inline">
        <input type="text" name="position" value="{$item.position}" placeholder="请输入职位" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-inline">
      <label class="layui-form-label">工作年限</label>
      <div class="layui-input-inline layui-input-wrap">
        <input type="text" name="year" value="{$item.year}" placeholder="请输入工作年限" autocomplete="off" class="layui-input">
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">特色标签</label>
      <div class="layui-input-inline">
        <input type="text" name="tag" value="{$item.tag}" placeholder="请输入特色标签" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-inline">
      <label class="layui-form-label">设计理念</label>
      <div class="layui-input-inline layui-input-wrap">
        <input type="text" name="idea" value="{$item.idea}" placeholder="请输入设计理念" autocomplete="off" class="layui-input">
      </div>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">简介</label>
    <div class="layui-input-block">
      <textarea id="desc" name="desc" style="width: 90%" autocomplete="on" class="layui-textarea">{$item.desc}</textarea>
    </div>
  </div>
  <div class="layui-form-item layui-hide">
    <input type="hidden" name="id" id="id" value="{$item.id}">
    <input type="button" lay-submit lay-filter="Lay-app-form-edit" id="Lay-app-form-edit" value="编辑">
  </div>
</div>
<script>
  layui.use(['layer', 'form', 'upload'], function(){
    var $ = layui.$
            ,upload = layui.upload
            ,form = layui.form;
    let id = '{$item.id}';
    let image_url = '{$item.image_url}';
    var uploadInst = upload.render({
      elem: '#Lay-app-form-picture'
      ,url: "{:url('uploadFile/UploadPicture')}"
      , data: {id:id,image_url:image_url}
      , before: function(obj){
        obj.preview(function(index, file, result){
          $('#test-upload-normal-img').attr('src', result);
        });
      }
      ,done: function(res){
        if(res.code == 0) {
          layer.msg(res.msg);
          $('#image_url').val(res.data.thumb_path);
        }else{
          layer.msg(res.data);
        }
      }
      ,error: function(){
        var demoText = $('#test-upload-demoText');
        demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs layui-btn-mini demo-reload">重试</a>');
        demoText.find('.demo-reload').on('click', function(){
          uploadInst.upload();
        });
      }
    });
  })
</script>
{include file="public/footer" /}